home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak 26 (Anniversary Edition)
/
Volume 26 [Anniversary Edition] - JOGO DISK .iso
/
DEPOSITO
/
REmovido
/
Esportes
/
LightningBreak.swf
/
scripts
/
frame_1
/
DoAction_2.as
next >
Wrap
Text File
|
2006-06-13
|
1KB
|
54 lines
_global.v2d = new Object();
_global.v2d.math = new Object();
_global.v2d.math.p2pDistance = function(x1, y1, x2, y2)
{
var tx = x2 - x1;
var ty = y2 - y1;
return Math.sqrt(tx * tx + ty * ty);
};
_global.v2d.math.squareHit = function(x1, y1, x2, y2, s)
{
return Math.abs(x1 - x2) <= s && Math.abs(y1 - y2) <= s;
};
_global.v2d.math.rectHit = function(x1, y1, x2, y2, sx, sy)
{
return Math.abs(x1 - x2) <= sx && Math.abs(y1 - y2) <= sy;
};
_global.v2d.math.withinRect = function(x1, y1, x2, y2, x3, y3)
{
return _global.v2d.math.numBetween(x1,x3,x2) == true && _global.v2d.math.numBetween(y1,y3,y2) == true;
};
_global.v2d.math.r2vertSgnAngle = function(x1, y1, x2, y2)
{
var rad = Math.asin((x2 - x1) / _global.v2d.math.p2pDistance(x1,y1,x2,y2));
return y2 > y1 ? 3.141592653589793 - rad : rad;
};
_global.v2d.math.r2vertCwAngle = function(x1, y1, x2, y2)
{
var temp = Math.asin((x2 - x1) / _global.v2d.math.p2pDistance(x1,y1,x2,y2));
if(temp < 0)
{
temp += 6.283185307179586;
}
return temp;
};
_global.v2d.math.numBetween = function(a, b, c)
{
if(a == c)
{
return b == a;
}
if(c > a)
{
return b > a && b < c;
}
return b > c && b < a;
};
_global.v2d.math.unify = function(v)
{
var l = Math.sqrt(v.x * v.x + v.y * v.y);
v.x /= l;
v.y /= l;
return v;
};